package com.fmsh.nfcsensor.tools;

import android.os.Handler;
import android.os.Looper;
import android.os.Message;

import androidx.annotation.NonNull;

/**
 * @author wuyajiang
 * @date 2022/2/28
 */
public class MyThread extends Thread {

    private RunHandler mRunHandler;
    private static MyThread myThread = new MyThread();
    private MyThread(){}

    public static MyThread getInstance() {
        return myThread;
    }

    public RunHandler getRunHandler() {
        return mRunHandler;
    }

    @Override
    public void run() {
        super.run();
        Looper.prepare();
        mRunHandler = new RunHandler();
        Looper.loop();


    }

    public class RunHandler extends Handler {
        @Override
        public void handleMessage(@NonNull Message msg) {
            super.handleMessage(msg);
            switch (msg.what){
                case 0:
                    NFCUtils.startNfcA(msg.getData());
                    break;
            }
        }
    }
}
